﻿using Kaskelot.SP.Model.Contracts;
using Kaskelot.SP.Services;
using Stockholm.SOA.Kaskelot.WCF.DataContracts;
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace Kaskelot.SP.UI.CONTROLTEMPLATES.Kaskelot.SP.UI.Forms
{
	public partial class EpostForm : BaseForm, IPostForm
	{
		public string[] IdList { get; set; }
		public string EpostLista { get; set; }

		protected void Page_Load(object sender, EventArgs e)
		{
			if (IdList != null)
			{
				foreach (string epost in IdList)
				{
					if (String.IsNullOrEmpty(EpostLista))
					{
						EpostLista = epost;
					}
					else if (!String.IsNullOrEmpty(epost))
					{
						EpostLista += ";" + epost;
					}
				}

				if (EpostLista.Length < 500)
				{
					MailToLink.HRef = "mailto:?bcc=" + EpostLista;
					OK.Visible = true;
					NOT_OK.Visible = false;
				}
				else
				{
					OK.Visible = false;
					NOT_OK.Visible = true;
				}
			}
		}
	}
}
